package member.dao;

import java.sql.SQLException;
import member.model.MemberInfo;
import java.util.List;
import java.util.Map;
import com.util.SqlMapLocator;
import comment.model.CommentVo;

public class MemberDAO {
	private static MemberDAO instance = new MemberDAO();
	public static MemberDAO getInstance(){
		return instance;
	}
	
	
	public List<MemberInfo> select(Object obj) throws Exception{
		List<MemberInfo> list = (List<MemberInfo>)SqlMapLocator.getMapper().queryForList("MemberSelect",obj);
		return list;
	}
	public int selectCnt() throws Exception{
		return (Integer)SqlMapLocator.getMapper().queryForObject("MemberCnt"); 
	}
	public MemberInfo selectOne(String userid) throws Exception{
		MemberInfo memberInfo = (MemberInfo)SqlMapLocator.getMapper().queryForObject("MemberSelectOne", userid);
		return memberInfo;
	}

	public void insert(Object obj) throws SQLException{
		SqlMapLocator.getMapper().insert("MemberInsert", (MemberInfo)obj );
	}
	public void update(Object obj) throws SQLException{
		SqlMapLocator.getMapper().update("memberUpdate",obj);
	}

	public void delete(String userid) throws Exception{
		SqlMapLocator.getMapper().delete("MemberDel", userid);
	}
	public MemberInfo login(Map info) throws Exception{
		return  (MemberInfo)SqlMapLocator.getMapper().queryForObject("Login", info);
	}
	
	
}
